#include <iostream>

class Interface {
public:
    virtual ~Interface() = default;

    virtual void Print() const = 0;
};

class A : public Interface {
public:
    virtual void Print() const override
    {
        std::cout << "A" << std::endl;
    }
};

class B : public Interface {
public:
    virtual void Print() const override
    {
        std::cout << "B" << std::endl;
    }
};

void Func(const Interface& i)
{
    i.Print();
}

class Object {
public:
    Object()
    {
        std::cout << "Object" << std::endl;
    }

    ~Object()
    {
        std::cout << "~Object" << std::endl;
    }

    void Print() const
    {
        std::cout << this << std::endl;
    }
};

void Func2(const Object &o)
{
    o.Print();
}

void Func2(Object &&o)
{
    o.Print();
}

int main()
{
    A a;
    B b;

    Func(a);
    Func(b);

    Object o;
    std::cout << "o: " << &o << std::endl;
    Func2(o);
    Func2(Object());
    return 0;
}
